home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / Drivers / vc_2_2.lha / ParNet / Source / defs.h next >
C/C++ Source or Header  |  1994-11-01  |  4KB  |  144 lines

  1. /*
  2. ** $Header: SRC:CVSROOT/Vector/ParNet/defs.h,v 1.1.1.1 1994/06/23 02:39:38 Barnard Exp $
  3. */
  4.  
  5. /*
  6. ** This code was originally written by Matthew Dillon and put into Public Domain
  7. **
  8. ** All changes concerning the adaption of Matt's original code to the
  9. ** Vector Connection I/O board are © 1991-1994 by Henning Schmiedehausen
  10. ** All rights for this changes are reserved. The original code is Public Domain
  11. **
  12. ** This code is distributed with the expressed written permission of Matthew
  13. ** Dillon (Thank you very much, Matt)
  14. **
  15. */
  16.  
  17. /*
  18.  *  DEFS.H
  19.  *
  20.  *  ---- NOTE, ONLY IOREQUEST STRUCTURE IS PUBLIC, ALL OTHER STRUCTURES
  21.  *     **WILL** CHANGE WITHOUT NOTICE ----
  22.  */
  23.  
  24. #define PARNET_SRC
  25.  
  26. #include <exec/types.h>
  27. #include <devices/trackdisk.h>
  28. #include <devices/timer.h>
  29. #include <libraries/dos.h>
  30. #include <hardware/intbits.h>
  31. #include <exec/errors.h>
  32. #include <exec/interrupts.h>
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35.  
  36. #define PORTNAME    "parnet.cfg"
  37.  
  38. #define MAXPKTSIZE  (8192+256)
  39.  
  40. #define IOF_QUEUED  0x02
  41. #define IOF_RUN     0x04
  42.  
  43. #define STRM_RESERVE    0x8000        /*    ports reserved for stream protocol */
  44. #define STRM_PORTS    512        /*    must be factor of 32           */
  45.  
  46. typedef unsigned char    ubyte;
  47. typedef unsigned short    uword;
  48. typedef unsigned long    ulong;
  49.  
  50. typedef struct Library    LIB;
  51. typedef struct MsgPort    PORT;
  52. typedef struct List    LIST;
  53. typedef struct Node    NODE;
  54. typedef struct MinNode    MNODE;
  55. typedef struct Task    Task;
  56. typedef struct Message    Message;
  57.  
  58. typedef struct timerequest IOT;
  59.  
  60. typedef long (*func_ptr)();
  61. typedef void (*func_void)();
  62.  
  63. typedef struct {
  64.     LIB     Lib;        /*    library node        */
  65.     ubyte   ParAddress;     /*    1-255            */
  66.     PORT    Port;        /*    task port        */
  67.     long    PLock[2];        /*    task lock        */
  68.     LIST    UnitList;        /*    active units (ports)    */
  69. } Device;
  70.  
  71. /*
  72.  *  Unit Core Structure (not user accessable) (do not access!)
  73.  */
  74.  
  75. typedef struct {
  76.     NODE    Node;        /*    link node   DO NOT MOVE */
  77.     func_void BeginIO;        /*    begin I/O   DO NOT MOVE */
  78.     func_void AbortIO;        /*    abort I/O   DO NOT MOVE */
  79.     func_void CloseFunc;
  80.     func_void DataFunc;     /*    low level packet data    */
  81.     uword   RefCnt;
  82.     uword   Port;        /*    core port ident     */
  83.     uword   Protocol;        /*    protocol id        */
  84.     ulong   DestAddr;        /*    destination  0 = self    */
  85.     uword   Flags;        /*    status flags        */
  86.     uword   State;        /*    (protocol private)      */
  87.     long    UnitLock[2];
  88.     LIST    PendIOR;        /*    pending read requests        */
  89.     LIST    PendIOW;        /*    pending write requests        */
  90.     LIST    PendCon;        /*    pending connect requests    */
  91.     LIST    PendLsn;        /*    pending listen requests     */
  92. } Unit;
  93.  
  94. /*
  95.  *  Io request structure and user defines
  96.  */
  97.  
  98. #include "devices/parnet.h"
  99.  
  100. typedef IOParReq    Iob;
  101.  
  102. /*
  103.  *  A low level network packet
  104.  */
  105.  
  106. typedef struct {
  107.     Message Msg;
  108.     Iob     *iob;            /*    IO req (unit_str)       */
  109.     Unit    *io_Unit;            /*    unit involved        */
  110.     ubyte   DestAddr;            /*    Destination machine    */
  111.     ubyte   Reserved;
  112.     uword   DestPort;            /*    Destination port no.    */
  113.     ulong   DLen1;            /*    Data Length        */
  114.     ulong   DLen2;            /*    Data Length        */
  115.     ubyte   *Data1;            /*    Data Pointer (lw algn)  */
  116.     ubyte   *Data2;            /*    Data Pointer (lw algn)  */
  117. } Packet;
  118.  
  119. /*
  120.  *  private public port to remember addr across closes.
  121.  */
  122.  
  123. typedef struct {
  124.     PORT    Port;
  125.     long    Address;
  126.     long    Timeout;
  127.     char    DebugBuf[32];
  128. } PubPort;
  129.  
  130. /*
  131.  *  Globals
  132.  */
  133.  
  134. extern long    ParLLTimeout;        /*    par.asm */
  135. extern Device    *DevBase;
  136. extern PubPort    *StickyPort;
  137.  
  138. extern Unit    *FindUnitForPort();
  139. extern Unit    *AllocUnit();
  140. extern Packet    *AllocParPacket();
  141. extern void    ReadConfig();
  142. extern void    WriteConfig();
  143.  
  144.